<?php

function getCsv($file_name)
{
	$file = fopen(APP_PATH.'../'.$file_name,"r");
	$rows=array();
	while(! feof($file))
	{
		$row=fgetcsv($file);
		$rows[$row[0]]=iconv("GBK","UTF-8",$row[1]);
		//$rows[$row[0]]=$row[1];
	}
	
	fclose($file);
	return $rows;
}

function replace_name($name_str)
{
	//$name_str='宁波国际投资咨询有限公司';
	$name_keys=array(
		'保税区',
		'宁波市',
		'宁波',
		'有限公司',
		'国际贸易',
	);
	
	//iconv("GB2312","UTF-8",$name_str);
	
	foreach($name_keys as $name_key)
	{
		//$name_key=iconv("UTF-8","GB2312",$name_key);
		//var_dump($name_key);
		$name_str=str_replace($name_key,'',$name_str,$i);
	}
	//var_dump($i);
	
	return $name_str;
}


function formtCompanyName($name_str)
{
	$name_str=trim($name_str);
	$name_str=preg_replace('# #', '', $name_str);
	$name_str=str_replace("大?","大碶",$name_str);
	$name_str=str_replace("新?","新碶",$name_str);
	$name_str=str_replace("40","(",$name_str);
	$name_str=str_replace("41",")",$name_str);
	$name_str=str_replace("（","(",$name_str);
	$name_str=str_replace("）",")",$name_str);
	//$name_str=str_replace("","",$name_str);
	//$name_str=str_replace("","",$name_str);


	return $name_str;
}

function getJgdmz($nsrsbh)
{
	return substr($nsrsbh,8,9);
}


function dump_r($str,$is_echo=true)
{
	addnewLog($str);
	if($is_echo) echo date("y-m-d H:i:s").'======>'.$str."\r\n";
}

?>